package by.plisitsa.railway.datamodel;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinTable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;

@Entity
public class Distance extends AbstractEntity {
	@Column
	private Integer startPointDist;
	
	@Column
	private Integer endPointDist;

	@Column
	private Integer distance;
	
	
	@JoinTable(name = "city_2_distance", joinColumns = { @JoinColumn(name = "distance_id") }, inverseJoinColumns = { @JoinColumn(name = "city_id") })
	@ManyToMany(targetEntity = City.class, fetch = FetchType.LAZY)
	private Set<City> citys;


	public Integer getStartPointDist() {
		return startPointDist;
	}


	public void setStartPointDist(Integer startPointDist) {
		this.startPointDist = startPointDist;
	}


	public Integer getEndPointDist() {
		return endPointDist;
	}


	public void setEndPointDist(Integer endPointDist) {
		this.endPointDist = endPointDist;
	}


	public Integer getDistance() {
		return distance;
	}


	public void setDistance(Integer distance) {
		this.distance = distance;
	}


	public Set<City> getCitys() {
		return citys;
	}


	public void setCitys(Set<City> citys) {
		this.citys = citys;
	}
	
}
